package com.yoomiito.app.widget.state;

import android.text.TextUtils;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;

import com.yoomiito.app.R;
import com.yoomiito.app.utils.DensityUtil;


/**
 */

public class EmptyType_2 extends LayoutType {

    private int layoutId;
    private String emptyContent;
    private int mHeight = -3;
    private OnShowViewListener mShowViewListener;

    public EmptyType_2() {
        this.layoutId = R.layout.layout_empty_3;
    }

    public EmptyType_2(int layoutId) {
        this.layoutId = layoutId;
    }

    @Override
    public int layoutId() {
        return layoutId;
    }

    @Override
    public void show(View emptyView) {
        TextView emptyTv = emptyView.findViewById(R.id.emptyTv);
        FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) emptyTv.getLayoutParams();
        if (mHeight!=-3) lp.height = mHeight;

        if (!TextUtils.isEmpty(emptyContent)){
            emptyTv.setText(emptyContent);
        }
        if (mShowViewListener!=null){
            mShowViewListener.showView(emptyView);
        }
    }

    @Override
    public void hide() {

    }

    public EmptyType_2 setmHeight(int mHeight) {
        this.mHeight = mHeight;
        return this;
    }

    public EmptyType_2 setEmptyContent(String emptyContent) {
        this.emptyContent = emptyContent;
        return this;
    }

    public EmptyType_2 setShowViewListener(OnShowViewListener showViewListener) {
        mShowViewListener = showViewListener;
        return this;
    }

    public interface OnShowViewListener{
        void showView(View view);
    }
}
